﻿@using Swallow.Entity
@model IEnumerable<User>

@{
    ViewBag.Title = "Users";
}

<div class="sub-navbar">
    <div style="margin-top:3px; float:right;">
        @using (Html.BeginForm("Index", "User", FormMethod.Get, new { @class = "form-inline" })) {
            <input type="text" class="form-control" value="@ViewBag.Query" name="query" placeholder="手机号/用户名">
            <button type="submit" class="btn btn-primary">搜索</button>
        }
    </div>

    <ul class="nav sub-navbar-nav">
        <li class="active">@Html.ActionLink("Index", "Index")</li>
        <li class="">@Html.ActionLink("在线用户", "IndexLineOn")</li>
        <li class="">@Html.ActionLink("Create", "Create")</li>
    </ul>
</div>

<table class="table">
    <tr>
        <th></th>
        <th>Name</th>
        <th>
            Status
            @Html.DropDownList("select_status", (IEnumerable<SelectListItem>)ViewBag.StatusSel, new { @class = "sel-query" })
        </th>
        <th>Rank</th>
        <th>CreateTime</th>
        <th>Cases</th>
        <th>Artilces</th>
        <th></th>
    </tr>
    @foreach (var item in Model) {
        <tr>
            <td>@item.Id - @item.Phone</td>
            <td>@item.Name</td>
            <td>@((UserStatus)item.Status)</td>
            <td>@item.Rank</td>
            <td>@item.CreateTime</td>
            <td>
                @Html.ActionLink(item.CaseCount.ToString(), "Index", "Case", new { userId = item.Id })
            </td>
            <td>
                @Html.ActionLink("articles", "Index", "Article", new { query = item.Id })
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.Id })
                @Html.ActionLink("Delete", "Delete", new { id = item.Id })
            </td>
        </tr>
    }
</table>

@section Scripts {
    <environment names="Development">
        <script src="~/js/index.js" asp-append-version="true"></script>
    </environment>
}